package com.shanks.framework.mq.domain;

/**
 * 订阅信息
 */
public class Subscription {
    /**
     * topic
     */
    private String topic;

    /**
     * 表达过滤
     */
    private String expression;

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public String getExpression() {
        return expression;
    }

    public void setExpression(String expression) {
        this.expression = expression;
    }

    public Subscription(String topic, String expression) {
        this.topic = topic;
        this.expression = expression;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Subscription that = (Subscription) o;

        if (!topic.equals(that.topic)) return false;
        return expression.equals(that.expression);
    }

    @Override
    public int hashCode() {
        int result = topic.hashCode();
        result = 31 * result + expression.hashCode();
        return result;
    }
}
